import java.math.*;
import java.util.ArrayList;

@SuppressWarnings("unused")
public class CornerPermutationTable {
	public int[][] cPermuteTable = new int[18][40320];
	public String unFactorial(int raw_decimal){
		//It changes back to the factorial form, but backwards.
		String result = "";
		int a = 2;
		while (true){
			int modulo = raw_decimal % a;
			result = result + Integer.toString(modulo);
			if (modulo > 0){
				raw_decimal -= modulo;
			}
			raw_decimal /= a;
			if (raw_decimal == 0) break;
			a++;
		}
		return result;
		
	}
	private int factorial(int n) { return n <= 1 ? 1 : n * factorial(n-1); } // quick factorial method
	public int reverseNotation(String unFactDecimal){
		//unFact decimal should have already been run through unFactorial
		//what we want to do is change the notation from the compacted position identifier 
		//to a more useful and easier manipulated notation of actual places where the cubes are
		String initGuess = "01234567"; 
						//  01234567 - Positions.
						//  03274165 - Goal
						//  00101412 - unFactDecimal
						
						// 	23476105
						//  00001562 
						//  23476105
		ArrayList<Integer>[] potentials= new ArrayList[7];
		for (int i = 0; i < potentials.length; i++){
			potentials[i] = new ArrayList<Integer>();
		}
		for (int i = 6; i != -1; i --){
			char character = unFactDecimal.charAt(i); //run through and create potential values for each of the digits.
			int digit = Character.digit(character, 10);
			for (int m = 0; m < 7 - digit; m++){
				if (i != 6 && m == potentials[6].get(0)) continue;
				potentials[i].add(m);
			}
		}
		//Go through the unFactDecimal right to left. Find max value that satisfies condition of the term.
		for (int i = 0; i < 7; i++){
			System.out.println(potentials[i].size());
		}
		return 0;
	}
	private int getCornerPermutation(int turn, int initPos){
		
		return 0;
	}
	
	public void genCornerPermutationTable(){
		
	}
	public CornerPermutationTable(){
		System.out.println(cPermuteTable.length);
	}
}
